#ifndef _FGL_H_
#define _FGL_H_

#include "common.h"

#define fglCACHE_LINE 32
#define fglCACHE_ALIGN __declspec(align(fglCACHE_LINE))

#define HFGL unsigned int
#define fglINDEX unsigned short

#define fglString std::string
#define fglChar char
#define fglWString std::wstring
#define fglWChar wchar_t
#define fglArray boost::container::vector
#define fglMap boost::container::map
#define fglUMap boost::unordered_map

#define fglPI 3.14159265358979f
#define fglPIhalf 1.570796326794895f
#define fglANG2RAD 0.01745329251994f
#define fglRAD2ANG 57.29577951309314f

#define fglEPSILON 0.000001f
#define fglEPSILONDEG 0.0001f
#define fglINFINITE 100000000000000.f

#define fglSHARE_NOTHING 0
#define fglSHARE_AVISUALS 1
#define fglSHARE_SKEL 2
#define fglSHARE_MESH 4
#define fglSHARE_LOD 8
#define fglSHARE_MATERIAL 16
#define fglSHARE_ANIM 32
#define fglSHARE_ALIGHTS 2
#define fglSHARE_ALL 255

#define fglMAX_BONES 4

int _CharToWChar(WCHAR** pcDest, const char* pcSrc, int pnLen);
int _CharToWChar(WCHAR** pcDest, const fglString& pcSrc);
int _CharToWChar(fglWString& pcDest, const fglString& pcSrc);
float fglSQR(const float& pnVal);

#define fglEVENT_hScene	1
#define fglEVENT_name 2
#define fglEVENT_fgl_class 3
#define fglEVENT_copy 4
#define fglEVENT_setProp 5
#define fglEVENT_getProp 6
#define fglEVENT_aNodes 7
#define fglEVENT_testNode 8
#define fglEVENT_size 9
#define fglEVENT_empty 10
#define fglEVENT_find 11
#define fglEVENT_nMinDist 12
#define fglEVENT_hNode1 13
#define fglEVENT_hNode2 14
#define fglEVENT_getNode1 15
#define fglEVENT_getNode2 16
#define fglEVENT_getDist 17
#define fglEVENT_add 18
#define fglEVENT_del 19
#define fglEVENT_reserve 20
#define fglEVENT_clear 21
#define fglEVENT_get 22
#define fglEVENT_fov 23
#define fglEVENT_ambient 24
#define fglEVENT_diffuse 25
#define fglEVENT_specular 26
#define fglEVENT_isSpot 27
#define fglEVENT_spotCutoff 28
#define fglEVENT_spotExp 29
#define fglEVENT_atten 30
#define fglEVENT_radius 31
#define fglEVENT_fontType 32
#define fglEVENT_fontSize 33
#define fglEVENT_fontName 34
#define fglEVENT_alignment 35
#define fglEVENT_lineLength 36
#define fglEVENT_lineSpacing 37
#define fglEVENT_outset 38
#define fglEVENT_depth 39
#define fglEVENT_text 40
#define fglEVENT_color_diffuse 41
#define fglEVENT_color_specular 42
#define fglEVENT_color_ambient 43
#define fglEVENT_color_emission 44
#define fglEVENT_color_transparent 45
#define fglEVENT_opacity 46
#define fglEVENT_shininess 47
#define fglEVENT_shininess_strength 48
#define fglEVENT_refracti 49
#define fglEVENT_lighting 50
#define fglEVENT_shading 51
#define fglEVENT_twosided 52
#define fglEVENT_wireframe 53
#define fglEVENT_hShader 54
#define fglEVENT_hTexture 55
#define fglEVENT_logFile 56
#define fglEVENT_logClear 57
#define fglEVENT_fontspath 58
#define fglEVENT_vsync 59
#define fglEVENT_loadGL 60
#define fglEVENT_isSupported 62
#define fglEVENT_aViewports 63
#define fglEVENT_move 64
#define fglEVENT_transformByBones 65
//#define fglEVENT_buildVBO 66
#define fglEVENT_create 67
#define fglEVENT_build 68
#define fglEVENT_isCompiled 69
#define fglEVENT_backColor 70
//#define fglEVENT_baseResolution 71
#define fglEVENT_nProj 72
#define fglEVENT_hCam 73
#define fglEVENT_hMaterial 74
#define fglEVENT_hRenderNode 75
#define fglEVENT_aLights 76
#define fglEVENT_attach 77
#define fglEVENT_detach 78
#define fglEVENT_isLinked 79
#define fglEVENT_hViewport 80
#define fglEVENT_hPickedVisual 81
#define fglEVENT_hPickedNode 82
#define fglEVENT_aPickedVisuals 83
#define fglEVENT_aPickedNodes 84
//#define fglEVENT_px 85
//#define fglEVENT_py 86
//#define fglEVENT_pz 87
//#define fglEVENT_gpx 88
#define fglEVENT_isPickDisabled 89
#define fglEVENT_nPickRadius 90
#define fglEVENT_isPickNearest 91
#define fglEVENT_pick 92
#define fglEVENT_getMove 93
//#define fglEVENT_sx 94
//#define fglEVENT_sy 95
//#define fglEVENT_sz 96
//#define fglEVENT_ra 97
//#define fglEVENT_rx 98
//#define fglEVENT_ry 99
//#define fglEVENT_rz 100
//#define fglEVENT_gsx 101
//#define fglEVENT_gsy 102
//#define fglEVENT_gsz 103
//#define fglEVENT_gra 104
//#define fglEVENT_grx 105
//#define fglEVENT_gry 106
//#define fglEVENT_grz 107
#define fglEVENT_buildTransform 108
#define fglEVENT_calcBounds 109
#define fglEVENT_setBoundsExt 110
#define fglEVENT_isEnabled 111
#define fglEVENT_isVisible 112
#define fglEVENT_boundsVisible 113
#define fglEVENT_boundsColor 114
#define fglEVENT_boundsFill 115
#define fglEVENT_boundsLineWidth 116
#define fglEVENT_boundsMeshType 117
#define fglEVENT_boundsLighting 118
//#define fglEVENT_bminz 119
//#define fglEVENT_bmaxx 120
//#define fglEVENT_bmaxy 121
//#define fglEVENT_bmaxz 122
//#define fglEVENT_bminex 123
//#define fglEVENT_bminey 124
//#define fglEVENT_bminez 125
//#define fglEVENT_bmaxex 126
//#define fglEVENT_bmaxey 127
//#define fglEVENT_bmaxez 128
#define fglEVENT_hParent 129
#define fglEVENT_aChilds 130
#define fglEVENT_aVisuals 131
#define fglEVENT_getVisuals 132
#define fglEVENT_getRotEuler 133
#define fglEVENT_rotateBy 134
#define fglEVENT_rotateTo 135
#define fglEVENT_moveDir 136
#define fglEVENT_moveBy 137
#define fglEVENT_moveTo 138
#define fglEVENT_scaleBy 139
#define fglEVENT_scaleAt 140
#define fglEVENT_scaleTo 141
#define fglEVENT_lookAt 142
#define fglEVENT_viewRangeMin 143
#define fglEVENT_viewRangeMax 144
#define fglEVENT_getViewRangeRot 145
#define fglEVENT_setViewRangeRot 146
//#define fglEVENT_vrrminz 147
//#define fglEVENT_vrrmaxx 148
//#define fglEVENT_vrrmaxy 149
//#define fglEVENT_vrrmaxz 150
#define fglEVENT_nStretch 151
#define fglEVENT_loadData 152
#define fglEVENT_aLODs 153
#define fglEVENT_aAnims 154
#define fglEVENT_hRootJoint 155
#define fglEVENT_findJoint 156
#define fglEVENT_buildLOD 157
#define fglEVENT_bindSkel 158
#define fglEVENT_duplicate 159
#define fglEVENT_duplicateMode 160
#define fglEVENT_getMaterials 161
#define fglEVENT_znear 162
#define fglEVENT_zfar 163
#define fglEVENT_getPos 164
#define fglEVENT_getScale 165
#define fglEVENT_getRotQuat 166
#define fglEVENT_getBounds 167
#define fglEVENT_getBoundsExt 168
#define fglEVENT_getTrgConstaints 169
#define fglEVENT_setTrgConstaints 170
#define fglEVENT_getLookAtPlane 171
#define fglEVENT_correctBoundsExt 172
#define fglEVENT_MSAAMode 173
#define fglEVENT_MSAAModeInfo 174
#define fglEVENT_render 175
#define fglEVENT_sleep 176
#define fglEVENT_testInFrustum 177
#define fglEVENT_project 178
#define fglEVENT_unproject 179
#define fglEVENT_getFPS 180
#define fglEVENT_getFrameTime 181
#define fglEVENT_getIdleTime 182
#define fglEVENT_getTime 183
#define fglEVENT_getLookAt 184
#define fglEVENT_setRotQuat 185

#endif
